<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title></title>

  <style type="text/css">
    * {
      margin: 0;
      padding: 0;
    }

    ul li {
      list-style: none;
    }

    #main {
      width: 760px;
      height: 300px;
      position: relative;
      margin: 50px auto;
    }

    #main .pic {
      width: 760px;
      height: 300px;

      overflow: hidden;
    }

    #main .pic ul li {
      width: 760px;
      height: 300px;
      position: relative;

    }

    #main .pic ul li .img1 {
      position: absolute;
      top: 0;
      left: -760px;
    }

    #main .pic ul li .img2 {
      position: absolute;
      top: 0;
      left: -20px;
      display: none;
    }

    #main .nav {
      position: absolute;
      right: 20px;
      bottom: 20px;
    }

    #main .nav ul li {
      width: 10px;
      height: 10px;
      border: 1px solid #fff;
      float: left;
      margin-left: 5px;
    }

    #main .nav ul li.select {
      background: #fff;
    }
  </style>

</head>

<body>

  <div id="main">
    <div class="pic">
      <ul>
        <li style="background: url(img/bg1.jpg);">
          <img class="img1" src="img/text1.png" />
          <img class="img2" src="img/con1.png" />
        </li>
        <li style="background: url(img/bg2.jpg);">
          <img class="img1" src="img/text2.png" />
          <img class="img2" src="img/con2.png" />
        </li>
        <li style="background: url(img/bg3.jpg);">
          <img class="img1" src="img/text3.png" />
          <img class="img2" src="img/con3.png" />
        </li>
        <li style="background: url(img/bg4.jpg);">
          <img class="img1" src="img/text4.png" />
          <img class="img2" src="img/con4.png" />
        </li>
        <li style="background: url(img/bg5.jpg);">
          <img class="img1" src="img/text5.png" />
          <img class="img2" src="img/con5.png" />
        </li>

      </ul>
    </div>
    <div class="nav">
      <ul>
        <li class="select"></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
      </ul>
    </div>

  </div>
  <div style="width: 100px; height: 100px; background: red; display: none;"></div>
  <script src="./js/jquery-1.11.3.js"></script>
  <script>
    $(function () {
      let i = 0;
      $(".pic li")
        .eq(0)
        .find(".img1")
        .animate({ left: 0 }, 800)
        .next()
        .show()
        .animate({ left: 0 }, 800)
      setInterval(function () {
        i++;
        if (i == $(".pic li").length) {
          i = 0;
        }
        $(".pic li")
          .eq(i)
          .fadeIn()
          .find(".img1")
          .animate({ left: 0 }, 800)
          .next()
          .show()
          .animate({ left: 0 }, 800)
          .end()
          .end()
          .siblings()
          .fadeOut()
          .find(".img2")
          .css({ left: "-760px" })
          .next()
          .hide()
          .css({ left: "-20px" })

        //焦点
        $(".nav li")
          .eq(i)
          .addClass("select")
          .siblings()
          .removeClass("select")
      }, 2000)
    })
  </script>
</body>

</html>